package com.util
{
	import org.papervision3d.core.math.Number3D;
	import org.papervision3d.core.math.Plane3D;
	import org.papervision3d.core.math.Sphere3D;
	import org.papervision3d.core.proto.CameraObject3D;
	import org.papervision3d.view.Viewport3D;
	
	public class DragTracer
	{
		public static function getIntersection(viewport:Viewport3D, camera:CameraObject3D, normal:Array):Number3D
		{
			var plane3D:Plane3D = new Plane3D(new Number3D(normal[0], normal[1], normal[2]), new Number3D(0, 0, 0));
			var cameraPosition:Number3D = new Number3D(camera.x, camera.y, camera.z);
			var ray:Number3D = camera.unproject(viewport.containerSprite.mouseX, viewport.containerSprite.mouseY);
			ray = Number3D.add(ray, cameraPosition);
			var intersect:Number3D = plane3D.getIntersectionLineNumbers(cameraPosition, ray);
			return intersect;
		}
	}
}